#ifndef EXITHANDLER_H_
#define EXITHANDLER_H_

#include <signal.h>
#include <assert.h>

#include "EventHandler.h"

class ExitHandler : public EventHandler {
	
private:
	sig_atomic_t gracefulQuit;
	
public:
	
	ExitHandler () : gracefulQuit(0) {
	}
	
	~ExitHandler () {
	}
	
	virtual int handleSignal ( int signum ) {
		assert ( signum == SIGQUIT || signum == SIGTERM);
		this->gracefulQuit = 1;
		return 0;
	}
	
	sig_atomic_t getGracefulQuit () const {
		return this->gracefulQuit;
	}
};

#endif /* EXITHANDLER_H_ */
